﻿using System;
using System.Linq;
using System.Linq.Expressions;
using ASPItalia.ModelVirtualCasting.Common;
using ASPItalia.ModelVirtualCasting.ObjectModel;

namespace ASPItalia.ModelVirtualCasting.EntityFramework
{
	public class JobLevelRepository : BaseRepository<JobLevel>, IJobLevelRepository
	{
		private IContextContainer _container;

		public JobLevelRepository(IContextContainer container) : base(container) {  }

		public IQueryable<JobLevel> GetAll()
		{
			return CurrentObjectQuery;
		}

		public IQueryable<JobLevel> Where(Expression<Func<JobLevel, bool>> predicate)
		{
			return CurrentObjectQuery.Where(predicate);
		}

		public long Count(Expression<Func<JobLevel, bool>> predicate)
		{
			return CurrentObjectQuery.Count(predicate);
		}

		public IJobLevelRepository Include(params string[] paths)
		{
			CurrentObjectQuery = CreateObjectQuery().Include(paths);
			return this;
		}

		public IJobLevelRepository EnableLazyLoading()
		{
			SetLazyLoading(true);
			return this;
		}

		public IJobLevelRepository DisableLazyLoading()
		{
			SetLazyLoading(false);
			return this;
		}
	}
}